package com.example.pay.config.pay;

import org.springframework.context.annotation.Configuration;

import java.io.FileWriter;
import java.io.IOException;

/**
 * @author ligen
 * @title: AliPayConfig
 * @projectName demo
 * @description:
 * @date 2019/6/1014:20
 */
@Configuration
public class AliPayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
//    netapp映射的地址，，，根据自己的需要修改
    private static String neturl = "http://6dynnj.natappfree.cc";

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号 按照我文章图上的信息填写
    public static String app_id = "9021000140651111";

    // 商户私钥，您的PKCS8格式RSA2私钥  刚刚生成的私钥直接复制填写
    public static String merchant_private_key ="MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCInIdhXnawv8VlPdlhe89qHz6fZnE95CzNLyWOoIoNF1HdKiYTt2JR8gIPm+X3K06ul26iaVoDrpOq2wgnoWiYEt+RmG26iwmW2eDw4ipLVos7OyU/pahOwVqEls2116Yaa1Up/8m4tCGufwV5/BILVVRfAXNPm/fcuDjrhHQCK+V9EbKMZE1IhGMizDNXHUyZNF9Y9DGkII1/iryxMVprywRMabDbU+V7ZU0ZP9mhMlcgTNi+DldrtRzDfOKYyWApYIoGuGCNshMb8Jy2fqnG9VjhRb8eHir/fPVQVoeXgjKEcp1Htc8Tr9h+U2OirhJ5GJc0K7xJtCNTaQGBqAO5AgMBAAECggEAZJh27FFGL0MX1URlBW7JPkkBsRkbfErAXts/2bYH0joA005NOamJYfRGZj4Tah3e05u5ISlY2ms8W8zsRVqLDaigLrNC4eGuTwHjrR2trUpuPlCATkzrEgs5X3c4xZWlv8CXttSfMz6ZqsfoPXpLw0KzXT5RLicYrtSNPYiMcGfVFBmAez98gOszKvWyFcWu6Bz0H9QImRJw0RI0YIyyD5ZSFio/ty3f1wbJcEu1kYeBb/+C8PVF/rCuF03s2Cxx0Icj+e/YEPqmpL0BDX1UYD4hFjku2hXpdgqMpdOcNq0z2oLInKmJITT640Qa1mXwHVNF/yX/TMIQSUPTmuCH3QKBgQC/5BLjscENFu0fwt2wW1lArdgZPDXVJBop4zZrZ+4Y+ZbiyxJ4vhCcvsZPs2UQVP0nbPqgE5qEftfrOQWEL15ekoFexp+Xanw+sCrI/yviSZajUwmADLviFho7ssdsl+RnkIkHdQR8aym3d9doidP/uHimX1yhg0/3u0rxn3C1TwKBgQC2QIv9Y2dmJu4TBX4OjvphDOnZmwgwpT92i7cDu41kGweBC7kPVbDyw45o/4gDKQK3rcG+GnMbqIfOBPD72YlsaRI1TA35hHaIh50eqeqUXX3EO1vBhRjI/9s5I4HCM5GJPVOFB/+46G87vmzXNUJ/we17uOak/uvxsQnR6QmEdwKBgAMNC0fXgaxFmwuQO5ocObUPjooILQrwggH8fNcEVgLLpRyCAg8tZnI3jkuiHI8/6q5/yxRUe3Zz1dcFlxLc9fEm/yuUmOD9bnBIuMVtWTNF3EFIhrQkf7A+jbg5RXZyi80hvSwDLkkUIxupqiEdX+OG+VQb3AstXU4hCjYBRPd9AoGBALWZP2QuZls9M0A02tR61zVY/rLbbZ+7KK9gq+3GNi6nWCTXn4COLBDZls88vzQW6yRGuKRKCqRmm1tHRTBOJEans4Lz04Dq4olMR9zEBn/rYGPlmZoMmxO9DZ2zqZnudHfBabVGsSJ4SE3Jgv41jZtris0bAocpk8RyWYyVnewlAoGAINc8+W1FEvG+j1HTqIul9ib97yXTnw5CDMycXnXNC3CmmJ//DSaYZAcfYnwGZQV8+c/5LQZwtdBq3SOl1B2J9+6KXTofKdgoq4dS4YN3VyLbKet6TiisyEu544H/khL/+58SQqkizR2xH/qHIm2hpfyTg7DP5+kX2KNFxsfFKok=";

    // 支付宝公钥,对应APPID下的支付宝公钥。 按照我文章图上的信息填写支付宝公钥，别填成商户公钥
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8ptz4sjvtlxbXakjy4Aroeva4tFI3mg85yyD1B5bePjH2RqPYA1H2UNSpW4ET99yyM5YUUB1sks8TqHl01TRCq30LS+E7eoJbTbZRFkkMbwx8xyJc2Orl+KJ9Y8+MM+Fayd/yvL/tTW3ZEYj+Odn1FiDzT6DUyq8Yoo8RNblFyZivPAEx1SgBtPSfIXOHPukvXCqYTyFGJXLaXBtXXOttbSCslZ14wPgXekcU92z+hqwPtb5XpSi2SOi53Mp8JJIuUgJfZ/fBUmzmnjovgvXRxb+XWFSpIzJVKndyeD6hzGclWu/9jkz/6baMu9XIQ8zVKyfB7RYt85++Vlh+w6GZQIDAQAB";
    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，其实就是你的一个支付完成后返回的页面URL
    public static String notify_url = neturl+"/alipay/notify_url";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，其实就是你的一个支付完成后返回的页面URL
    public static String return_url = neturl+"/alipay/return_url";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }



}
